<?php
class Model_DbTable_Sync extends Zend_Db_Table_Abstract
{
    protected $_name = 'sync';
    protected $_primary = 'post_id';
    
    public function getUnSyncLjPosts()
    {
        return $this->fetchAll('lj_id is null');
    }
    
    public function saveLjPostId($ljPostId , $post_id = null)
    {
        if($post_id !== null){
            $this->insert(array('lj_id'=>$ljPostId));
        } else {
           $this->update(array('lj_id' => $ljPostId) , 'post_id = ' . (int) $post_id); 
        }
    }
}